package com.appos.web.controller;

import com.appos.common.core.controller.BaseController;
import com.appos.common.core.domain.AjaxResult;
import com.appos.domain.ApplicationInfo;
import com.appos.service.ApplicationInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class ApplicationInfoController extends BaseController {

    @Autowired
    private ApplicationInfoService applicationInfoService;

    @PostMapping("/applicationInfo/save")
    public AjaxResult save(@RequestBody ApplicationInfo applicationInfo){
        return toAjax(applicationInfoService.save(applicationInfo));
    }

    @PostMapping("/applicationInfo/edit")
    public AjaxResult edit(@RequestBody ApplicationInfo applicationInfo){
        return toAjax(applicationInfoService.updateApplicationInfo(applicationInfo));
    }

    @GetMapping("/applicationInfo/list")
    public AjaxResult list(){
        return AjaxResult.success(applicationInfoService.findAll());
    }

    @GetMapping("/applicationInfo/delete")
    public AjaxResult delete(@RequestParam String appId){
        return AjaxResult.success(applicationInfoService.deleteApplicationInfoByAppId(appId));
    }

}
